#ifndef MMPF_ENCAPI_API
#define MMPF_ENCAPI_API
#include "mmpf_timer.h"

#define AFE_SAMPLES_TIME    (1) // (2)
#define ENC_SAMPLES_TIME    (1) // 4 ms
#define PRC_SAMPLES_TIME    (1) // (4) // How many samples for audio lib to process each time

//#if ENC_SAMPLES_TIME==1
//#define ENC_INBUF_FRAME_NUM  (8) //(16)//(8) How many ring buffer slot
//#else
//#define ENC_INBUF_FRAME_NUM  (4)//(8) How many ring buffer slot
//#endif

//#define ENC_MAX_SAMPLES  ( 48 * AUDIN_CHANNEL *  ENC_SAMPLES_TIME )// 48000 / 1000 * 2 ch * ENC_SAMPLES_TIME ms = 384.
// (192)   // 48000 / 1000 * 2 ch * 2 ms = 192.
//#define ENC_INBUF_SIZE  (ENC_MAX_SAMPLES*ENC_INBUF_FRAME_NUM)  

//#define PRC_INBUF_SIZE  (ENC_MAX_SAMPLES * PRC_SAMPLES_TIME)

typedef enum _AUDIO_SIZE_READ_TYPE
{ 
    SIZE_CAN_WR=0,
    SIZE_CAN_PR,
    SIZE_CAN_RD
} AUDIO_SIZE_READ_TYPE ;

void MMPF_Audio_EncodeFrame(void);
void MMPF_Audio_InitEncoder(MMP_SHORT samples_per_frame);
MMP_BOOL MMPF_Audio_IsEmpty(void);
MMP_BOOL MMPF_Audio_IsFull(void);
//int MMPF_Audio_Move2AudioRingBuffer(MMP_SHORT samples);
void MMPF_Audio_Move2USBFifo(MMP_SHORT samples);
void MMPF_Audio_UpdateWrPtr(MMP_ULONG size);
void MMPF_Audio_UpdateRdPtr(MMP_ULONG size);
void MMPF_Audio_UpdatePrPtr(MMP_ULONG size);
void MMPF_Audio_UpdatePtrByType(AUDIO_SIZE_READ_TYPE type,MMP_ULONG size);
MMP_ULONG MMPF_Audio_GetPrPtr(void);
MMP_ULONG MMPF_Audio_GetWrPtr(void);
MMP_ULONG MMPF_Audio_GetRdPtr(void);
int MMPF_Audio_GetSizeByType(AUDIO_SIZE_READ_TYPE type);
void MMPF_Audio_ExitEncoder(void);
MMP_BOOL MMPF_Audio_IsSkipPostProcessing(void);
void MMPF_Audio_SkipPostProcessing(MMP_BOOL flag);
MMP_ERR MMPF_Audio_Tx(MMP_SHORT samples);
void MMPF_Audio_TimerOpen(MMP_ULONG us,MMPF_TIMER_ID id);
void MMPF_Audio_TimerClose(MMPF_TIMER_ID id);
void MMPF_Audio_TimerISR(void);


//#define ONE_TIME_BUFFER_SIZE  64 // 1ms
/*
#define TOTAL_BUFFER_MS 16  // 8 MS is tatal buffer size
//#define TOTAL_BUFFER_SIZE TOTAL_BUFFER_MS*ONE_TIME_BUFFER_SIZE
#define UPPER_BOUND 12  // 6 ms 
#define MIDER_BOUND 8  // 4 ms 
#define LOWER_BOUND 4   // 2 ms 
*/

#endif
